<?php
class modmulticontainer extends CI_Model{
	var $multicontainer = "multi_container";

	function __construct()
	{
		parent::__construct();
	}
	
	function setData($id_multi_container,$id_multi_content,$title_multi_container,$date_multi_container,$container_multi_content,$file_upload)
	{
		$this->id_multi_container= $id_multi_container;
		$this->id_multi_content= $id_multi_content;
		$this->title_multi_container= $title_multi_container;
		$this->date_multi_container= $date_multi_container;
		$this->container_multi_content= $container_multi_content;
		$this->file_upload= $file_upload;
	}
	
	function getList($id_multi_content,$page){		$query="			SELECT * 			FROM multi_container mc			LEFT JOIN multi_content muc on muc.id_multi_content = mc.id_multi_content			WHERE muc.id_multi_content ='".$id_multi_content."'			LIMIT ".$page."			";
		$query = $this->db->query($query);
		if($query->num_rows() > 0){
			foreach($query->result_array() as $row){
				$result[] = $row;
			}
			return $result;
		} else {
			return false;
		}	
	}
	
	function create()
	{		
		$arrayData = array(
			'id_multi_container'=>$this->id_multi_container,
			'id_multi_content'=>$this->id_multi_content,
			'title_multi_container'=>$this->title_multi_container,
			'date_multi_container'=>$this->date_multi_container,
			'container_multi_content'=>$this->container_multi_content,
			'file_upload'=>$this->file_upload
		);
		return $this->db->insert($this->multicontainer, $arrayData);
	}
	
	function update($id_multi_container)
	{
		$arrayData = array(
			'id_multi_content'=>$this->id_multi_content,
			'title_multi_container'=>$this->title_multi_container,
			'date_multi_container'=>$this->date_multi_container,
			'container_multi_content'=>$this->container_multi_content,
			'file_upload'=>$this->file_upload
		);
		$this->db->where('id_multi_container', $id_multi_container);
		return $this->db->update($this->multicontainer, $arrayData);
	}
        
	function remove($id_multi_container)
	{
		$this->db->where('id_multi_container', $id_multi_container);
		return $this->db->delete($this->multicontainer);
	}	
	
	function detail($id_multi_container)
	{
		$this->db->where('id_multi_container', $id_multi_container);
		$query = $this->db->get($this->multicontainer);	
		return $query->result_array();
	}
	
	function getListSearch($name){
		$this->db->like('title_multi_container',$name);
		$query = $this->db->get($this->multicontainer);
		if($query->num_rows() > 0){
			foreach($query->result_array() as $row){
				$result[] = $row;
			}
			return $result;
		} else {
			return false;
		}	
	}
	
	function getDetailContent($id_multi_container)
	{
		$this->db->where('id_multi_container', $id_multi_container);
		$query = $this->db->get($this->multicontainer);	
		return $query->result_array();
	}
}
?>